class Fruit(object):  # ⽗类Fruit
    def makejuice(self):
        print('i can make juice')


class Apple(Fruit):  # ⼦类：苹果
    # 重写⽗类⽅法
    def makejuice(self):
        print('i can make apple juice')


class Banana(Fruit):  # ⼦类：⾹蕉
    # 重写⽗类⽅法
    def makejuice(self):
        print('i can make banana juice')


class Orange(Fruit):  # ⼦类：橘⼦
    # 重写⽗类⽅法
    def makejuice(self):
        print('i can make orange juice')


# 定义⼀个公共接⼝（专⻔⽤于实现榨汁操作）
def service(obj):
    # obj要求是⼀个实例化对象，可以传⼊苹果对象/⾹蕉对象
    obj.makejuice()


# 调⽤公共⽅法
service(Orange())
service(Banana())
service(Apple())
